package cn.sfrog.project.biz.admin.task;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.sfrog.project.biz.admin.service.IBizLiveRoomService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 预约直播推送任务
 */
@Component
@Slf4j
@EnableScheduling
public class LiveTask {

    @Resource
    private IBizLiveRoomService bizLiveRoomService;


    /**
     * 每2分钟执行一次
     * 查询预约直播的直播间，临近开播时间进行推送直播消息
     */
//    @Scheduled(cron = "0/30 * * * * ?")
    @Scheduled(cron = "0 0/2 * * * ?")
    public void sendMessage() {
        bizLiveRoomService.sendLivePlayNotifyMessage();
    }


}
